package plantshop.controller.moves;

import java.io.Serializable;

import plantshop.model.Customer;
import plantshop.model.Game;
import plantshop.model.Location;

public class CustomerBuyMove extends TimeMove implements Serializable{
	private static final long serialVersionUID = 1763252932677377965L;
	private int x,y;
	private Customer customer;
	
	public CustomerBuyMove(Location goal, Customer customer){
		x = goal.getX();
		y = goal.getY();
		this.customer = customer;
	}

	@Override
	public void execute(Game game) {
		int disp, loc;
		Location l = game.getStore().getPlantAtLoc(x, y);
		if(l != null){
			disp = l.getX();
			loc = l.getY();
			customer.setMoneyNum(game.sellPlant(disp, loc));
			customer.setDisplayMoneySign(100);
			
		}
	}

}
